package com.yubest.server1.controller;

import brave.Span;
import brave.Tracer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class HelloController {

    @Autowired
    private Tracer tracer;

    @GetMapping(value = "/hello")
    public Object hello() {
        log.info("spring-cloud-server1 -> this is log");
        Span span = tracer.currentSpan();
        log.info("traceId: {}, spanId: {}", span.context().traceIdString(), span.context().spanIdString());
        return "Hello Spring Cloud Server1";
    }
}
